import { Injectable } from '@angular/core';

import { Observable } from 'rxjs';

import { HttpRequestService } from '../core/services/http-request.service';

@Injectable()
export class CamundaBpmnViewerService {
    private readonly url: String = '/process';

    constructor(
        private httpRequestService: HttpRequestService
    ) { }

    getProcessDefinitionModelByProcessDefinitionId(processDefinitionId: String): Observable<any> {
        return this.httpRequestService.getText(`${this.url}/getProcessDefinitionModelByProcessDefinitionId`, {
            processDefinitionId: processDefinitionId
        });
    }

    getHistoricProcessInstance(processInstanceId: String): Observable<any> {
        return this.httpRequestService.get(`${this.url}/getHistoricProcessInstance`, {
            processInstanceId: processInstanceId
        });
    }
}